//
//  BKHttpRequestManager.h
//  BCommon
//
//  Created by baboy on 4/1/15.
//  Copyright (c) 2015 baboy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "BKHttpRequestCachePolicy.h"

#ifndef _BKHttpRequestManager_
    #define _BKHttpRequestManager_

typedef enum _BKHttpResponseType {
    BKHttpResponseTypeData = 0,
    BKHttpResponseTypeStandard,
    BKHttpResponseTypeJSON,
    BKHttpResponseTypeString
}BKHttpResponseType;

NS_ASSUME_NONNULL_BEGIN
@interface BKHttpRequestManager :AFHTTPSessionManager /*: AFHTTPRequestOperationManager*/
@property (nonatomic, strong) NSArray *cacheRequestIgnoreParams;

+ (_Nonnull id)defaultManager;
+ (_Nonnull id)manager;

- (nullable id )getJSON:(nullable NSString *)URLString
             parameters:(nullable id)parameters
            cachePolicy:(BKHttpRequestCachePolicy)cachePolicy
                success:(nullable void (^)(id _Nonnull task, id _Nullable json))success
                failure:(nullable void (^)(id _Nullable task,id _Nullable json, NSError * _Nonnull error))failure;

- (nullable id)getJSON:(nullable NSString *)URLString
            parameters:(nullable id)parameters
               success:(nullable void (^)(id _Nonnull task, id _Nullable json))success
               failure:(nullable void (^)(id _Nullable task,id _Nullable json, NSError * _Nonnull error))failure;

- (nullable id )getData:(nullable NSString *)URLString
             parameters:(nullable id)parameters
            cachePolicy:(BKHttpRequestCachePolicy)cachePolicy
                success:(nullable void (^)(id _Nonnull task, id _Nullable json))success
                failure:(nullable void (^)(id _Nullable task,id _Nullable json, NSError * _Nonnull error))failure;

- (nullable id)POST:(NSString *)URLString
         parameters:(nullable id)parameters
       responseType:(BKHttpResponseType)responseType
            success:(nullable void (^)(id _Nonnull task, id _Nullable responseObject))success
            failure:(nullable void (^)(id _Nonnull task, NSError *error))failure;

- (nullable id)download:(NSString *_Nullable)URLString
            cachePolicy:(BKHttpRequestCachePolicy)cachePolicy
            userInfo:(id _Nullable)userInfo
               progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgressBlock
                success:(nullable void (^)(id _Nonnull task, id _Nullable fp))success
                failure:(nullable void (^)(id _Nullable task,id _Nullable fp, NSError * _Nonnull error))failure;

- (nullable id)download:(NSString *_Nullable)URLString
            cachePolicy:(BKHttpRequestCachePolicy)cachePolicy
               progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgressBlock
                success:(nullable void (^)(id _Nonnull task, id _Nullable fp))success
                failure:(nullable void (^)(id _Nullable task,id _Nullable fp, NSError * _Nonnull error))failure;

- (nullable id)download:(NSString *_Nullable)URLString
               progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgressBlock
                success:(nullable void (^)(id _Nonnull task, id _Nullable fp))success
                failure:(nullable void (^)(id _Nullable task,id _Nullable fp, NSError * _Nonnull error))failure;


@end
NS_ASSUME_NONNULL_END
#endif
